<template>
	<view class="contont">
<image src="../../static/img/pic_logo.png" mode=""></image>
<input type="text" value="请输入账户" v-model="account" class="tarone"/>
<input type="password" value="请输入密码" v-model="Password" class="tartwo"/>
<view class="Tips">{{Tip}}</view>
<view class="">
</view>
<view style="color: #888888;width: 100%;font-size: 13px;margin-left: 30px;margin-top: 30rpx;">注册即表示您同意并愿意遵守<text style="color: #042A58;"  @click="Agreements">《注册协议》</text></view>
<button  @click="Sign">登录</button>
	</view>
</template>

<script>
	import { ajaxapi} from "../../api.js"
	export default {
		data() {
			return {
				account:"",
				Password:"",
				Tip:""
			}
		},
		// 分享
		onShareAppMessage: function( options ){
		　　var that = this;
		　　// 设置菜单中的转发按钮触发转发事件时的转发内容
		　　var shareObj = {
		　　　　title: "优货达货主",        // 默认是小程序的名称(可以写slogan等)
		　　　　path: '',        // 默认是当前页面，必须是以‘/’开头的完整路径
		　　　　imageUrl:"../../static/img/fenxiang.png",     //自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
		　　};
		　　// 返回shareObj
		　　return shareObj;
		},
		onLoad() {
	wx.hideHomeButton();
		},
		
	methods: {
		Agreements(){
			uni.navigateTo({
				url:"../Agreement/Agreement"
			})
		},
	          Sign(){
				  var that=this
				   ajaxapi({
				  	url:"/v1/manager/loginsubmit",
					method:"post",
					data:{
					account:this.account,
					password:this.Password,
					},
					success(res) {
						console.log(res)
					uni.setStorageSync("sessionid", res.header["Set-Cookie"])
					var name=[res.data.status,that.account,that.Password]
						uni.setStorage({
							key:"name",
							data:name
						})
					if(res.data.status=="OK"){
				  uni.switchTab({
						url:"../captains/captains"
					})
					}else{
						if(res.data.message=="用户登陆失败，验证不合法"){
							uni.showToast({
							    title: '账户密码不正确请重新输入',
								icon:"none"
							})
						}else{
							uni.showToast({
							    title: res.data.message,
								icon:"none"
							})
						}
					}				
					},
				
				  })
			
				
			  }
			 
	        }	
	}
</script>

<style>
image{
	width: 356rpx;
	height: 108rpx;
	margin-top: 123rpx;
	margin-left: 198rpx;
}
	
input{
	width:297px;
	height:  92rpx;
	border-bottom:1px solid #F0F0F0 ;
	margin-left: 50rpx;
	padding-left:56rpx;
}
.tarone{
	margin-top: 130rpx;
	background-image: url(../../static/img/icon_zhanghao.png);
	background-repeat: no-repeat;
	background-size: 56rpx 56rpx;
	background-position:0px 18rpx;
}
.tartwo{
	margin-top: 44rpx;
	background-image: url(../../static/img/icon-password.png);
	background-repeat: no-repeat;
	background-size: 56rpx 56rpx;
	background-position:0rpx 18rpx;
}
.Tips{
	width:297px;
	height:  92rpx;
	margin-left: 50rpx;
	display: flex;
	align-items: center;
	color: #FE0700;
}	
button{
	margin-top: 38px;
	width:325px;
	height:44px;
	background:rgba(4,42,88,1);
	border-radius:8px;
	color: #FFFFFF;
	font-size: 16px;
}
</style>
